
#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
#define OK 1
#define ERROR 0
#define OVERFLOW -2
typedef int ElemType;
typedef int Status;
using namespace std;
typedef struct StackNode
{
    ElemType data;
    struct StackNode *next;
}StackDode,*LinkStack;
Status InitStack(LinkStack &s)
{
    s=NULL;
    return OK;
}
Status Push(LinkStack &s,ElemType e)
{
    StackDode *p;
    p=new StackNode;
    p->next=s;
    s=p;
    return OK;
}
Status Pop(LinkStack &s,ElemType &e)
{
    LinkStack p;
    e=s->data;
    p=s;
    s=s->next;
    delete p;
    return OK;
}
ElemType GetTop(LinkStack s)
{
    if(s!=NULL)
        return s->data;
}
int main()
{
    LinkStack p;
    InitStack(p);
    int e;
    for(int i=0;i<5;i++)
    {
    cin>>e;
    Push(p,e);
     }
    Pop(p,e);
    cout <<e;
    e=GetTop(p);
    cout <<e;
    return 0;


}
